Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 싸피 15반 알고리즘 스터디 17주차 [이종환]
📌 문제 풀이 개요
✅ 문제 해결 여부
💡 풀이 방법
문제 1: 어항 정리
문제 난이도
플레5
문제 유형
'구현' , '시뮬레이션'
접근 방식 및 풀이
처음에는 두개의 접는 방식을 공통 메서드로 구현하려 했었는데, 자세히 읽어보니 접는 방식이 달라서 각각 구현하였다. 인풋값이 엄청 큰 것이 아니기에 2차원 배열과 인덱스관리를 통해 접는 것과 그 후 분배를 구현하였다.
문제 2: 휴게소 세우기
문제 난이도
골드4
문제 유형
이분 탐색접근 방식 및 풀이
처음에는 그리디하게 접근하려고 했는데 계속해서 실패했다.
다시 생각해보니 특정 값이 정답인지 아닌지를 판단하는 데 소요되는 연산이 그리 심하지 않았기에, 이분탐색을 통해 N개 이하의 휴게소를 통해 만들 수 있는 최댓값 중 최솟값을 구하였다.
문제 3: 줄 세우기
문제 난이도
골드4
문제 유형
DP,LIS접근 방식 및 풀이
전형적인 LIS 문제였다.
인풋값이 크지 않기에 O(N^2) 방식으로도
dp 테이블을 만들면 손쉽게 풀 수 있다.
문제 4: 공통 부분 문자열
문제 난이도
골드5
문제 유형
dp,LCS접근 방식 및 풀이
인풋의 길이가 4000이하여서 그냥 이중 for문을 통해 해결하였다. 이번 문제들 중 가장 쉬웠던 문제.
문제 5: 전구와 스위치
문제 난이도
골드4
문제 유형
그리디접근 방식 및 풀이
어항 다음으로 많은 시간을 쏟았다.
단순한 DP로는 안 풀리고, 일일히 완탐을 하는 것은 불가능 해보였다.
그런데 잘 생각해보니 결국 첫 스위치를 누른다/안 누른다 분기만 설정하면 그 다음 스위치는 입력값에 의해 자동으로 결정되었다. 이를 통해 풀이 자체는 간단하게 풀 수 있었다.